package com.zhiche.lisa.bms.dao.model.contract;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
 * 合同主表
 * </p>
 *
 * @author liuanshun
 * @since 2018-11-05
 */
@TableName("lisa_contract")
public class Contract extends Model<Contract> {

    private static final char splitStr = ',';
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 合同编码
     */
    @TableField(value = "cont_code")
    private String contCode;
    /**
     * 合同名称
     */
    @TableField("cont_name")
    private String contName;
    /**
     * 合同状态：0-新增; 1-审核中; 2-已审核; 3-审核不通过; 4-作废
     */
    @TableField("cont_state")
    private Long contState;
    /**
     * 甲方id
     */
    @TableField("first_party_id")
    private Long firstPartyId;
    /**
     * 甲方名称
     */
    @TableField("first_party_name")
    private String firstPartyName;
    /**
     * 乙方类型：0-承运商、1-车队、2-司机
     */
    @TableField("second_party_type")
    private Integer secondPartyType;
    /**
     * 乙方id
     */
    @TableField("fleet_type_id")
    private Long fleetTypeId;
    /**
     * 乙方名称
     */
    @TableField("fleet_type_name")
    private String fleetTypeName;
    /**
     * 对应车队名称集合, 用逗号分隔
     */
    @TableField("fleet_names")
    private String fleetNames;
    /**
     * 对应车队id集合, 用逗号分隔
     */
    @TableField("fleet_ids")
    private String fleetIds;
    /**
     * 扣点系数
     */
    private BigDecimal rate;
    /**
     * 运输方式
     */
    @TableField("shipping_type")
    private Long shippingType;
    /**
     * 账期：0-N; 1-N+1; 2-N+2; 3-N+3
     */
    @TableField("pay_days")
    private Integer payDays;
    /**
     * 是否预付: 0-是; 1-否
     */
    @TableField("is_prepay")
    private Integer isPrepay;
    /**
     * 合同类型:  0-正式; 1-临时
     */
    @TableField("contract_type")
    private Integer contractType;
    /**
     * 合同属性:  0-新增; 1-补充; 2-续签
     */
    @TableField("contract_pro")
    private Integer contractPro;
    /**
     * 保证金
     */
    @TableField("cash_deposit")
    private BigDecimal cashDeposit;
    /**
     * 月支付:  0-(X<2W); 1-(2W≤X＜10W); 2-(10W≤X＜20W); 3-(20W≤X＜50W); 4-(50W≤X＜100W); 5-(X≥100W)
     */
    @TableField("pay_month")
    private Integer payMonth;
    /**
     * 税点
     */
    private BigDecimal tax;
    /**
     * 价格标准:  0-(合同价>标准价);  1-(合同价≤标准价);  2-无标准价;  3-(账期为N\4-账期为N且合同价＞标准件)
     */
    @TableField("standard_sum")
    private Integer standardSum;
    /**
     * 备注
     */
    private String remark;
    /**
     * 业务所属客户
     */
    @TableField("business_client")
    private String businessClient;
    /**
     * 业务背景
     */
    @TableField("business_und")
    private String businessUnd;
    /**
     * 生效日期
     */
    @TableField("effective_date")
    private Date effectiveDate;
    /**
     * 失效日期
     */
    @TableField("invalid_date")
    private Date invalidDate;
    /**
     * 创建时间
     */
    @TableField("gmt_create")
    private Date gmtCreate;
    /**
     * 修改时间
     */
    @TableField("gmt_modify")
    private Date gmtModify;
    /**
     * 创建者账号
     */
    private Long creator;
    /**
     * 拥有者账号
     */
    private Long proprietor;
    /**
     * 租户
     */
    @TableField("tenant_id")
    private Long tenantId;
    /**
     * 支付方式（0-开票、1-现金)
     */
    @TableField("pay_way")
    private Integer payWay;
    /**
     * 标准件支付系数
     */
    @TableField("pay_rate")
    private BigDecimal payRate;
    /**
     * 油卡支付预付比例
     */
    @TableField("oil_prepay_rate")
    private BigDecimal oilPrepayRate;
    /**
     * 油卡支付尾款比例
     */
    @TableField("oil_finalpay_rate")
    private BigDecimal oilFinalpayRate;
    /**
     * 现金支付预付比例
     */
    @TableField("cash_prepay_rate")
    private BigDecimal cashPrepayRate;
    /**
     * 现金支付尾款比例
     */
    @TableField("cash_finalpay_rate")
    private BigDecimal cashFinalpayRate;

    @TableField(exist = false)
    private String[] fleetNameList;

    @TableField(exist = false)
    private String[] fleetIdList;

    /**
     * 创建人
     */
    @TableField("creator_name")
    private String creatorName;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getContCode() {
        return contCode;
    }

    public void setContCode(String contCode) {
        this.contCode = contCode;
    }

    public String getContName() {
        return contName;
    }

    public void setContName(String contName) {
        this.contName = contName;
    }

    public Long getContState() {
        return contState;
    }

    public void setContState(Long contState) {
        this.contState = contState;
    }

    public Long getFirstPartyId() {
        return firstPartyId;
    }

    public void setFirstPartyId(Long firstPartyId) {
        this.firstPartyId = firstPartyId;
    }

    public String getFirstPartyName() {
        return firstPartyName;
    }

    public void setFirstPartyName(String firstPartyName) {
        this.firstPartyName = firstPartyName;
    }

    public Integer getSecondPartyType() {
        return secondPartyType;
    }

    public void setSecondPartyType(Integer secondPartyType) {
        this.secondPartyType = secondPartyType;
    }

    public Long getFleetTypeId() {
        return fleetTypeId;
    }

    public void setFleetTypeId(Long fleetTypeId) {
        this.fleetTypeId = fleetTypeId;
    }

    public String getFleetTypeName() {
        return fleetTypeName;
    }

    public void setFleetTypeName(String fleetTypeName) {
        this.fleetTypeName = fleetTypeName;
    }

    public String getFleetNames() {
        return fleetNames;
    }

    public void setFleetNames(String fleetNames) {
        String[] splitNames = StringUtils.split(fleetNames, splitStr);
        fleetNameList = splitNames;
        this.fleetNames = fleetNames;
    }

    public String getFleetIds() {
        return fleetIds;
    }

    public void setFleetIds(String fleetIds) {
        String[] splitIds = StringUtils.split(fleetIds, splitStr);
        fleetIdList = splitIds;
        this.fleetIds = fleetIds;
    }

    public BigDecimal getRate() {
        return rate;
    }

    public void setRate(BigDecimal rate) {
        this.rate = rate;
    }

    public Long getShippingType() {
        return shippingType;
    }

    public void setShippingType(Long shippingType) {
        this.shippingType = shippingType;
    }

    public Integer getPayDays() {
        return payDays;
    }

    public void setPayDays(Integer payDays) {
        this.payDays = payDays;
    }

    public Integer getIsPrepay() {
        return isPrepay;
    }

    public void setIsPrepay(Integer isPrepay) {
        this.isPrepay = isPrepay;
    }

    public Integer getContractType() {
        return contractType;
    }

    public void setContractType(Integer contractType) {
        this.contractType = contractType;
    }

    public Integer getContractPro() {
        return contractPro;
    }

    public void setContractPro(Integer contractPro) {
        this.contractPro = contractPro;
    }

    public BigDecimal getCashDeposit() {
        return cashDeposit;
    }

    public void setCashDeposit(BigDecimal cashDeposit) {
        this.cashDeposit = cashDeposit;
    }

    public Integer getPayMonth() {
        return payMonth;
    }

    public void setPayMonth(Integer payMonth) {
        this.payMonth = payMonth;
    }

    public BigDecimal getTax() {
        return tax;
    }

    public void setTax(BigDecimal tax) {
        this.tax = tax;
    }

    public Integer getStandardSum() {
        return standardSum;
    }

    public void setStandardSum(Integer standardSum) {
        this.standardSum = standardSum;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getBusinessClient() {
        return businessClient;
    }

    public void setBusinessClient(String businessClient) {
        this.businessClient = businessClient;
    }

    public String getBusinessUnd() {
        return businessUnd;
    }

    public void setBusinessUnd(String businessUnd) {
        this.businessUnd = businessUnd;
    }

    public Date getEffectiveDate() {
        return effectiveDate;
    }

    public void setEffectiveDate(Date effectiveDate) {
        this.effectiveDate = effectiveDate;
    }

    public Date getInvalidDate() {
        return invalidDate;
    }

    public void setInvalidDate(Date invalidDate) {
        this.invalidDate = invalidDate;
    }

    public Date getGmtCreate() {
        return gmtCreate;
    }

    public void setGmtCreate(Date gmtCreate) {
        this.gmtCreate = gmtCreate;
    }

    public Date getGmtModify() {
        return gmtModify;
    }

    public void setGmtModify(Date gmtModify) {
        this.gmtModify = gmtModify;
    }

    public Long getCreator() {
        return creator;
    }

    public void setCreator(Long creator) {
        this.creator = creator;
    }

    public Long getProprietor() {
        return proprietor;
    }

    public void setProprietor(Long proprietor) {
        this.proprietor = proprietor;
    }

    public Long getTenantId() {
        return tenantId;
    }

    public void setTenantId(Long tenantId) {
        this.tenantId = tenantId;
    }

    public Integer getPayWay() {
        return payWay;
    }

    public void setPayWay(Integer payWay) {
        this.payWay = payWay;
    }

    public BigDecimal getPayRate() {
        return payRate;
    }

    public void setPayRate(BigDecimal payRate) {
        this.payRate = payRate;
    }

    public BigDecimal getOilPrepayRate() {
        return oilPrepayRate;
    }

    public void setOilPrepayRate(BigDecimal oilPrepayRate) {
        this.oilPrepayRate = oilPrepayRate;
    }

    public BigDecimal getOilFinalpayRate() {
        return oilFinalpayRate;
    }

    public void setOilFinalpayRate(BigDecimal oilFinalpayRate) {
        this.oilFinalpayRate = oilFinalpayRate;
    }

    public BigDecimal getCashPrepayRate() {
        return cashPrepayRate;
    }

    public void setCashPrepayRate(BigDecimal cashPrepayRate) {
        this.cashPrepayRate = cashPrepayRate;
    }

    public BigDecimal getCashFinalpayRate() {
        return cashFinalpayRate;
    }

    public void setCashFinalpayRate(BigDecimal cashFinalpayRate) {
        this.cashFinalpayRate = cashFinalpayRate;
    }

    public String[] getFleetNameList() {
        return fleetNameList;
    }

    public void setFleetNameList(String[] fleetNameList) {
        String joinNames = StringUtils.join(fleetNameList, splitStr);
        fleetNames = joinNames;
        this.fleetNameList = fleetNameList;
    }

    public String[] getFleetIdList() {
        return fleetIdList;
    }

    public void setFleetIdList(String[] fleetIdList) {
        String joinIds = StringUtils.join(fleetIdList, splitStr);
        fleetIds = joinIds;
        this.fleetIdList = fleetIdList;
    }

    public String getCreatorName() {
        return creatorName;
    }

    public void setCreatorName(String creatorName) {
        this.creatorName = creatorName;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "Contract{" +
                ", id=" + id +
                ", contCode=" + contCode +
                ", contName=" + contName +
                ", contState=" + contState +
                ", firstPartyId=" + firstPartyId +
                ", firstPartyName=" + firstPartyName +
                ", secondPartyType=" + secondPartyType +
                ", fleetTypeId=" + fleetTypeId +
                ", fleetTypeName=" + fleetTypeName +
                ", fleetNames=" + fleetNames +
                ", fleetIds=" + fleetIds +
                ", rate=" + rate +
                ", shippingType=" + shippingType +
                ", payDays=" + payDays +
                ", isPrepay=" + isPrepay +
                ", contractType=" + contractType +
                ", contractPro=" + contractPro +
                ", cashDeposit=" + cashDeposit +
                ", payMonth=" + payMonth +
                ", tax=" + tax +
                ", standardSum=" + standardSum +
                ", remark=" + remark +
                ", businessClient=" + businessClient +
                ", businessUnd=" + businessUnd +
                ", effectiveDate=" + effectiveDate +
                ", invalidDate=" + invalidDate +
                ", gmtCreate=" + gmtCreate +
                ", gmtModify=" + gmtModify +
                ", creator=" + creator +
                ", proprietor=" + proprietor +
                ", tenantId=" + tenantId +
                ", payWay=" + payWay +
                ", payRate=" + payRate +
                ", oilPrepayRate=" + oilPrepayRate +
                ", oilFinalpayRate=" + oilFinalpayRate +
                ", cashPrepayRate=" + cashPrepayRate +
                ", cashFinalpayRate=" + cashFinalpayRate +
                "}";
    }
}
